<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <meta charset="utf-8"/>
    <title>Swoole-API-文档</title>
    <meta name="author" content=""/>
    <meta name="description" content=""/>

    <link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
    <link href="../css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/prism.css" rel="stylesheet" media="all"/>
    <link href="../css/template.css" rel="stylesheet" media="all"/>
    
    <!--[if lt IE 9]>
    <script src="../js/html5.js"></script>
    <![endif]-->
    <script src="../js/jquery-1.11.0.min.js"></script>
    <script src="../js/ui/1.10.4/jquery-ui.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/jquery.smooth-scroll.js"></script>
    <script src="../js/prism.min.js"></script>
    <!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit-->
    <script type="text/javascript">
    function loadExternalCodeSnippets() {
        Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
            var src = pre.getAttribute('data-src');
            var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
            var language = 'php';

            var code = document.createElement('code');
            code.className = 'language-' + language;

            pre.textContent = '';

            code.textContent = 'Loading…';

            pre.appendChild(code);

            var xhr = new XMLHttpRequest();

            xhr.open('GET', src, true);

            xhr.onreadystatechange = function () {
                if (xhr.readyState == 4) {

                    if (xhr.status < 400 && xhr.responseText) {
                        code.textContent = xhr.responseText;

                        Prism.highlightElement(code);
                    }
                    else if (xhr.status >= 400) {
                        code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
                    }
                    else {
                        code.textContent = '✖ Error: File does not exist or is empty';
                    }
                }
            };

            xhr.send(null);
        });
    }

    $(document).ready(function(){
        loadExternalCodeSnippets();
    });
    $('#source-view').on('shown', function () {
        loadExternalCodeSnippets();
    })
</script>

    <link rel="shortcut icon" href="../images/favicon.ico"/>
    <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/>
    <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/>
    <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/>
</head>
<body>

<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <i class="icon-ellipsis-vertical"></i>
            </a>
            <a class="brand" href="../index.html">Swoole-API-文档</a>

            <div class="nav-collapse">
                <ul class="nav pull-right">
                                        <li class="dropdown">
                        <a href="../index.html" class="dropdown-toggle" data-toggle="dropdown">
                            API Documentation <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                                                        <li><a href="../namespaces/Swoole.html">\Swoole</a></li>
                                                    </ul>
                    </li>
                                        <li class="dropdown" id="charts-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            Charts <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a href="../graphs/class.html">
                                    <i class="icon-list-alt"></i>&#160;Class hierarchy diagram
                                </a>
                            </li>
                        </ul>
                    </li>
                    <li class="dropdown" id="reports-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            Reports <b class="caret"></b>
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a href="../reports/errors.html">
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <i class="icon-list-alt"></i>&#160;Errors <span class="label label-info pull-right">71</span>
                                </a>
                            </li>
                            <li>
                                <a href="../reports/markers.html">
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <i class="icon-list-alt"></i>&#160;Markers <span class="label label-info pull-right">0</span>
                                </a>
                            </li>
                            <li>
                                <a href="../reports/deprecated.html">
                                                                                                            <i class="icon-list-alt"></i>&#160;Deprecated <span class="label label-info pull-right">0</span>
                                </a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!--<div class="go_to_top">-->
    <!--<a href="#___" style="color: inherit">Back to top&#160;&#160;<i class="icon-upload icon-white"></i></a>-->
    <!--</div>-->
</div>

<div id="___" class="container-fluid">
        <section class="row-fluid">
        <div class="span2 sidebar">
                                <div class="accordion" style="margin-bottom: 0">
        <div class="accordion-group">
            <div class="accordion-heading">
                                    <a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-102088045"></a>
                                <a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
            </div>
            <div id="namespace-102088045" class="accordion-body collapse in">
                <div class="accordion-inner">

                                                    <div class="accordion" style="margin-bottom: 0">
        <div class="accordion-group">
            <div class="accordion-heading">
                                    <a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1937652861"></a>
                                <a href="../namespaces/Swoole.html" style="margin-left: 30px; padding-left: 0">Swoole</a>
            </div>
            <div id="namespace-1937652861" class="accordion-body collapse ">
                <div class="accordion-inner">

                                                    <div class="accordion" style="margin-bottom: 0">
        <div class="accordion-group">
            <div class="accordion-heading">
                                    <a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1129906264"></a>
                                <a href="../namespaces/Swoole.Http.html" style="margin-left: 30px; padding-left: 0">Http</a>
            </div>
            <div id="namespace-1129906264" class="accordion-body collapse ">
                <div class="accordion-inner">

                    
                    <ul>
                                                                                                    <li class="class"><a href="../classes/Swoole.Http.Client.html">Client</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Http.Request.html">Request</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Http.Response.html">Response</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Http.Server.html">Server</a></li>
                                            </ul>
                </div>
            </div>
        </div>
    </div>

                                                    <div class="accordion" style="margin-bottom: 0">
        <div class="accordion-group">
            <div class="accordion-heading">
                                    <a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-1209406496"></a>
                                <a href="../namespaces/Swoole.WebSocket.html" style="margin-left: 30px; padding-left: 0">WebSocket</a>
            </div>
            <div id="namespace-1209406496" class="accordion-body collapse ">
                <div class="accordion-inner">

                    
                    <ul>
                                                                                                    <li class="class"><a href="../classes/Swoole.WebSocket.Frame.html">Frame</a></li>
                                                    <li class="class"><a href="../classes/Swoole.WebSocket.Server.html">Server</a></li>
                                            </ul>
                </div>
            </div>
        </div>
    </div>

                    
                    <ul>
                                                                                                    <li class="class"><a href="../classes/Swoole.Atomic.html">Atomic</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Buffer.html">Buffer</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Client.html">Client</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Lock.html">Lock</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Process.html">Process</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Redis.html">Redis</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Server.html">Server</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Table.html">Table</a></li>
                                                    <li class="class"><a href="../classes/Swoole.Timer.html">Timer</a></li>
                                            </ul>
                </div>
            </div>
        </div>
    </div>

                    
                    <ul>
                                                                                                    <li class="class"><a href="../classes/swoole_atomic.html">swoole_atomic</a></li>
                                                    <li class="class"><a href="../classes/swoole_buffer.html">swoole_buffer</a></li>
                                                    <li class="class"><a href="../classes/swoole_client.html">swoole_client</a></li>
                                                    <li class="class"><a href="../classes/swoole_http_client.html">swoole_http_client</a></li>
                                                    <li class="class"><a href="../classes/swoole_http_request.html">swoole_http_request</a></li>
                                                    <li class="class"><a href="../classes/swoole_http_response.html">swoole_http_response</a></li>
                                                    <li class="class"><a href="../classes/swoole_http_server.html">swoole_http_server</a></li>
                                                    <li class="class"><a href="../classes/swoole_lock.html">swoole_lock</a></li>
                                                    <li class="class"><a href="../classes/swoole_process.html">swoole_process</a></li>
                                                    <li class="class"><a href="../classes/swoole_redis.html">swoole_redis</a></li>
                                                    <li class="class"><a href="../classes/swoole_server.html">swoole_server</a></li>
                                                    <li class="class"><a href="../classes/swoole_server_port.html">swoole_server_port</a></li>
                                                    <li class="class"><a href="../classes/swoole_table.html">swoole_table</a></li>
                                                    <li class="class"><a href="../classes/swoole_websocket_server.html">swoole_websocket_server</a></li>
                                            </ul>
                </div>
            </div>
        </div>
    </div>

        </div>
    </section>
    <section class="row-fluid">
        <div class="span10 offset2">
            <div class="row-fluid">
                <div class="span8 content class">
                    <nav>
                                                <a href="../namespaces/Swoole.html">\Swoole</a> <i class="icon-level-up"></i>
                                            </nav>
                    <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a>

                    <h1><small>\Swoole</small>Client</h1>
                    <p><em>swoole_client</em></p>
                    <p>Author: EagleWu <a href="mailto:eaglewudi@gmail.com">eaglewudi@gmail.com</a>
Date: 2016/02/17</p>
                    
                                        
                    <section id="summary">
                        <h2>Summary</h2>
                        <section class="row-fluid heading">
                            <section class="span4">
                                <a href="#methods">Methods</a>
                            </section>
                            <section class="span4">
                                <a href="#properties">Properties</a>
                            </section>
                            <section class="span4">
                                <a href="#constants">Constants</a>
                            </section>
                        </section>
                        <section class="row-fluid public">
                            <section class="span4">
                                                                    <a href="../classes/Swoole.Client.html#method___construct" class="">__construct()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_connect" class="">connect()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_send" class="">send()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_sendto" class="">sendto()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_recv" class="">recv()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_close" class="">close()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_on" class="">on()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_isConnected" class="">isConnected()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_getsockname" class="">getsockname()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_getpeername" class="">getpeername()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_set" class="">set()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_sleep" class="">sleep()</a><br />
                                                                    <a href="../classes/Swoole.Client.html#method_wakeup" class="">wakeup()</a><br />
                                                            </section>
                            <section class="span4">
                                                                    <a href="../classes/Swoole.Client.html#property_errCode" class="">$errCode</a><br />
                                                                    <a href="../classes/Swoole.Client.html#property_sock" class="">$sock</a><br />
                                                            </section>
                            <section class="span4">
                                                                    <em>No constants found</em>
                                                            </section>
                        </section>
                        <section class="row-fluid protected">
                            <section class="span4">
                                                                    <em>No protected methods found</em>
                                                            </section>
                            <section class="span4">
                                                                    <em>No protected properties found</em>
                                                            </section>
                            <section class="span4">
                                <em>N/A</em>
                            </section>
                        </section>
                        <section class="row-fluid private">
                            <section class="span4">
                                                                    <em>No private methods found</em>
                                                            </section>
                            <section class="span4">
                                                                    <em>No private properties found</em>
                                                            </section>
                            <section class="span4">
                                <em>N/A</em>
                            </section>
                        </section>
                    </section>
                </div>
                <aside class="span4 detailsbar">
                                        
                    
                    <dl>
                        <dt>File</dt>
                            <dd><a href="../files/Client.html"><div class="path-wrapper">Client.php</div></a></dd>
                                                <dt>Package</dt>
                            <dd><div class="namespace-wrapper">Default</div></dd>
                                                <dt>Class hierarchy</dt>
                            <dd class="hierarchy">
                                                                                                                                                                    <div class="namespace-wrapper">\Swoole\Client</div>
                            </dd>

                        
                        
                        
                        
                                                                        </dl>
                    <h2>Tags</h2>
                    <table class="table table-condensed">
                                            <tr><td colspan="2"><em>None found</em></td></tr>
                                        </table>
                </aside>
            </div>

                        
                                    <a id="properties" name="properties"></a>
            <div class="row-fluid">
                <div class="span8 content class">
                    <h2>Properties</h2>
                </div>
                <aside class="span4 detailsbar"></aside>
            </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="property_errCode" name="property_errCode" class="anchor"></a>
            <article class="property">
                <h3 class="public ">$errCode</h3>
                <pre class="signature">$errCode : </pre>
                <p><em>函数执行错误会设置该变量</em></p>
                

                                <h4>Type</h4>
                
                                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                        <dl>
                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="property_sock" name="property_sock" class="anchor"></a>
            <article class="property">
                <h3 class="public ">$sock</h3>
                <pre class="signature">$sock : integer</pre>
                <p><em>socket的文件描述符</em></p>
                <p>PHP代码中可以使用:
$sock = fopen(&quot;php://fd/&quot;.$swoole_client-&gt;sock);</p>
<p>将swoole_client的socket转换成一个stream socket。可以调用fread/fwrite/fclose等函数进程操作。
swoole_server中的$fd不能用此方法转换，因为$fd只是一个数字，$fd文件描述符属于主进程
$swoole_client-&gt;sock可以转换成int作为数组的key.</p>

                                <h4>Type</h4>
                integer
                                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                        <dl>
                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                                            
                                    <a id="methods" name="methods"></a>
            <div class="row-fluid">
                <div class="span8 content class"><h2>Methods</h2></div>
                <aside class="span4 detailsbar"></aside>
            </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method___construct" name="method___construct" class="anchor"></a>
            <article class="method">
                <h3 class="public ">__construct()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">__construct(integer  <span class="argument">$sock_type</span>, integer  <span class="argument">$sync_type = SWOOLE_SOCK_SYNC</span>, string  <span class="argument">$connectionKey = &#039;&#039;</span>) </pre>
                <p><em>swoole_client构造函数</em></p>
                

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td>integer</td>
                                <td>$sock_type </td>
                                <td><p>指定socket的类型，支持TCP/UDP、TCP6/UDP64种</p></td>
                            </tr>
                                                    <tr>
                                <td>integer</td>
                                <td>$sync_type </td>
                                <td><p>SWOOLE_SOCK_SYNC/SWOOLE_SOCK_ASYNC  同步/异步</p></td>
                            </tr>
                                                    <tr>
                                <td>string</td>
                                <td>$connectionKey </td>
                                <td><p>链接的编号，用于长连接复用</p></td>
                            </tr>
                                            </table>
                
                
                				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_connect" name="method_connect" class="anchor"></a>
            <article class="method">
                <h3 class="public ">connect()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">connect(string  <span class="argument">$host</span>, integer  <span class="argument">$port</span>, float  <span class="argument">$timeout = 0.1</span>, integer  <span class="argument">$flag</span>) : boolean</pre>
                <p><em>连接到远程服务器</em></p>
                

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td>string</td>
                                <td>$host </td>
                                <td><p>是远程服务器的地址 v1.6.10+ 支持填写域名 Swoole会自动进行DNS查询</p></td>
                            </tr>
                                                    <tr>
                                <td>integer</td>
                                <td>$port </td>
                                <td><p>是远程服务器端口</p></td>
                            </tr>
                                                    <tr>
                                <td>float</td>
                                <td>$timeout </td>
                                <td><p>是网络IO的超时，单位是s，支持浮点数。默认为0.1s，即100ms</p></td>
                            </tr>
                                                    <tr>
                                <td>integer</td>
                                <td>$flag </td>
                                <td><p>参数在UDP类型时表示是否启用udp_connect。设定此选项后将绑定$host与$port，此UDP将会丢弃非指定host/port的数据包。
在send/recv前必须使用swoole_client_select来检测是否完成了连接</p></td>
                            </tr>
                                            </table>
                
                
                                    <h4>Returns</h4>
                    boolean
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_send" name="method_send" class="anchor"></a>
            <article class="method">
                <h3 class="public ">send()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">send(string  <span class="argument">$data</span>) : boolean</pre>
                <p><em>向远程服务器发送数据</em></p>
                <p>参数为字符串，支持二进制数据。
成功发送返回的已发数据长度
失败返回false，并设置$swoole_client-&gt;errCode</p>

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td>string</td>
                                <td>$data </td>
                                <td></td>
                            </tr>
                                            </table>
                
                
                                    <h4>Returns</h4>
                    boolean
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_sendto" name="method_sendto" class="anchor"></a>
            <article class="method">
                <h3 class="public ">sendto()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">sendto(  <span class="argument">$ip</span>,   <span class="argument">$port</span>,   <span class="argument">$data</span>) </pre>
                <p><em>向任意IP:PORT的服务器发送数据包，仅支持UDP/UDP6的client</em></p>
                

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td></td>
                                <td>$ip </td>
                                <td></td>
                            </tr>
                                                    <tr>
                                <td></td>
                                <td>$port </td>
                                <td></td>
                            </tr>
                                                    <tr>
                                <td></td>
                                <td>$data </td>
                                <td></td>
                            </tr>
                                            </table>
                
                
                				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_recv" name="method_recv" class="anchor"></a>
            <article class="method">
                <h3 class="public ">recv()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">recv(integer  <span class="argument">$size = 65535</span>, boolean  <span class="argument">$waitall = false</span>) : string</pre>
                <p><em>从服务器端接收数据</em></p>
                <p>如果设定了$waitall就必须设定准确的$size，否则会一直等待，直到接收的数据长度达到$size
如果设置了错误的$size，会导致recv超时，返回 false
调用成功返回结果字符串，失败返回 false，并设置$swoole_client-&gt;errCode属性</p>

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td>integer</td>
                                <td>$size </td>
                                <td><p>接收数据的最大长度</p></td>
                            </tr>
                                                    <tr>
                                <td>boolean</td>
                                <td>$waitall </td>
                                <td><p>是否等待所有数据到达后返回</p></td>
                            </tr>
                                            </table>
                
                
                                    <h4>Returns</h4>
                    string
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_close" name="method_close" class="anchor"></a>
            <article class="method">
                <h3 class="public ">close()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">close() : boolean</pre>
                <p><em>关闭远程连接</em></p>
                <p>swoole_client对象在析构时会自动close</p>

                
                
                                    <h4>Returns</h4>
                    boolean
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_on" name="method_on" class="anchor"></a>
            <article class="method">
                <h3 class="public ">on()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">on(  <span class="argument">$event_name</span>,   <span class="argument">$callback_function</span>) : boolean</pre>
                <p><em>注册异步事件回调函数</em></p>
                

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td></td>
                                <td>$event_name </td>
                                <td></td>
                            </tr>
                                                    <tr>
                                <td></td>
                                <td>$callback_function </td>
                                <td></td>
                            </tr>
                                            </table>
                
                
                                    <h4>Returns</h4>
                    boolean
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_isConnected" name="method_isConnected" class="anchor"></a>
            <article class="method">
                <h3 class="public ">isConnected()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">isConnected() : boolean</pre>
                <p><em>判断是否连接到服务器</em></p>
                

                
                
                                    <h4>Returns</h4>
                    boolean
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_getsockname" name="method_getsockname" class="anchor"></a>
            <article class="method">
                <h3 class="public ">getsockname()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">getsockname() : boolean</pre>
                <p><em>获取客户端socket的host:port信息</em></p>
                

                
                
                                    <h4>Returns</h4>
                    boolean
                                            &mdash; <p>| array</p>
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_getpeername" name="method_getpeername" class="anchor"></a>
            <article class="method">
                <h3 class="public ">getpeername()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">getpeername() : boolean</pre>
                <p><em>获取远端socket的host:port信息，仅用于UDP/UDP6协议
UDP发送数据到服务器后，可能会由其他的Server进行回复</em></p>
                

                
                
                                    <h4>Returns</h4>
                    boolean
                                            &mdash; <p>| array</p>
                                    				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_set" name="method_set" class="anchor"></a>
            <article class="method">
                <h3 class="public ">set()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">set(array  <span class="argument">$setting</span>) </pre>
                <p><em>设置客户端参数</em></p>
                

                                    <h4>Parameters</h4>
                    <table class="table table-condensed table-hover">
                                                    <tr>
                                <td>array</td>
                                <td>$setting </td>
                                <td></td>
                            </tr>
                                            </table>
                
                
                				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_sleep" name="method_sleep" class="anchor"></a>
            <article class="method">
                <h3 class="public ">sleep()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">sleep() </pre>
                <p><em>睡眠，停止接收数据</em></p>
                

                
                
                				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                    <div class="row-fluid">
        <div class="span8 content class">
            <a id="method_wakeup" name="method_wakeup" class="anchor"></a>
            <article class="method">
                <h3 class="public ">wakeup()</h3>
                <a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
                <pre class="signature" style="margin-right: 54px;">wakeup() </pre>
                <p><em>唤醒，开始接收数据</em></p>
                

                
                
                				
                            </article>
        </div>
        <aside class="span4 detailsbar">
            <h1><i class="icon-arrow-down"></i></h1>
                                                            <dl>
                                                                            </dl>
            <h2>Tags</h2>
            <table class="table table-condensed">
                                    <tr><td colspan="2"><em>None found</em></td></tr>
                            </table>
        </aside>
    </div>

                                                                    </div>
    </section>

    <div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="source-view-label">Client.php</h3>
        </div>
        <div class="modal-body">
            <pre data-src="../files/Client.php.txt" class="language-php line-numbers"></pre>
        </div>
    </div>

    <footer class="row-fluid">
        <section class="span10 offset2">
            <section class="row-fluid">
                <section class="span10 offset1">
                    <section class="row-fluid footer-sections">
                        <section class="span4">
                                                        <h1><i class="icon-code"></i></h1>
                            <div>
                                <ul>
                                                                            <li><a href="../namespaces/Swoole.html">\Swoole</a></li>
                                                                    </ul>
                            </div>
                        </section>
                        <section class="span4">
                                                        <h1><i class="icon-bar-chart"></i></h1>
                            <div>
                                <ul>
                                    <li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li>
                                </ul>
                            </div>
                        </section>
                        <section class="span4">
                                                        <h1><i class="icon-pushpin"></i></h1>
                            <div>
                                <ul>
                                    <li><a href="../reports/errors.html">Errors</a></li>
                                    <li><a href="../reports/markers.html">Markers</a></li>
                                </ul>
                            </div>
                        </section>
                    </section>
                </section>
            </section>
            <section class="row-fluid">
                <section class="span10 offset1">
                    <hr />
                    Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
                    on February 25th, 2016 at 20:01.
                </section>
            </section>
        </section>
    </footer>
</div>

</body>
</html>
